home *** CD-ROM | disk | FTP | other *** search
/ Champak 49 / Volume 49 - JOGO DISK .iso / Games / evilswitch.swf / scripts / DefineSprite_60 / frame_1 / DoAction.as
Encoding:
Text File  |  2007-09-27  |  1.2 KB  |  68 lines

  1. this.timerMask_mc._yscale = 0;
  2. this.init = function()
  3. {
  4.    if(this.pPause == undefined)
  5.    {
  6.       this.pPause = true;
  7.       this.pSpeed = 0.2;
  8.       this.pTime = 100;
  9.       this.pStep = 100;
  10.    }
  11. };
  12. this.increaseSpeed = function()
  13. {
  14.    this.pSpeed += 0.02;
  15. };
  16. this.addTimer = function(t)
  17. {
  18.    this.pTime += t * 1.5;
  19.    this.pStep = this.pTime;
  20.    this.drawTimer();
  21. };
  22. this.resetTimer = function()
  23. {
  24.    this.pPause = true;
  25.    this.pStep = 100;
  26.    this.pTime = 100;
  27. };
  28. this.pauseTimer = function()
  29. {
  30.    delete onEnterFrame;
  31.    this.pPause = true;
  32. };
  33. this.resumeTimer = function()
  34. {
  35.    this.onEnterFrame = animate;
  36.    this.pPause = false;
  37. };
  38. this.fire = function()
  39. {
  40.    this.pauseTimer();
  41.    this._parent.grid_mc.gameOver();
  42.    this._parent.grid_mc.selector_mc.removeSelector();
  43. };
  44. this.drawTimer = function()
  45. {
  46.    if(this.pTime > 100)
  47.    {
  48.       this.pTime = 100;
  49.    }
  50.    else if(this.pTime < 0)
  51.    {
  52.       this.pTime = 0;
  53.       this.fire();
  54.    }
  55.    if(this.pTime <= this.pStep)
  56.    {
  57.       this.pStep -= 2;
  58.       this.timerMask_mc._yscale = 100 - this.pTime;
  59.    }
  60. };
  61. this.animate = function()
  62. {
  63.    this.pTime -= this.pSpeed;
  64.    this.drawTimer();
  65. };
  66. this.init();
  67. stop();
  68.